package com.yh.patterns.combination.organization_office;

/**
 * @Auther:云尚学Java
 */
public class Client {
    public static void main(String[] args) {
        OrganizationComponent beijing = new DeptComponent();
        beijing.setName("北京总部");
        OrganizationComponent jiaowuOffice1 = new Office();
        jiaowuOffice1.setName("一级教务办公室");
        OrganizationComponent hunanfenxiao = new DeptComponent();
        hunanfenxiao.setName("湖南分校");
        OrganizationComponent xingzhengOffice = new Office();
        xingzhengOffice.setName("一级行政办公室");
        OrganizationComponent jiaowuOffice2 = new Office();
        jiaowuOffice2.setName("二级教务办公室");
        OrganizationComponent changshaJiaoxuediao = new DeptComponent();
        changshaJiaoxuediao.setName("长沙教学点");
        OrganizationComponent xiangtanjiaoxuedian = new DeptComponent();
        xiangtanjiaoxuedian.setName("湘潭教学点");
        OrganizationComponent xingzhengOffice2 = new Office();
        xingzhengOffice2.setName("二级行政办公室");
        OrganizationComponent jiaowuOffice3 = new Office();
        jiaowuOffice3.setName("教务办公室——长沙");
        OrganizationComponent xingzhengOffice3 = new Office();
        xingzhengOffice3.setName("行政办公室——长沙");
        OrganizationComponent jiaowuOffice4 = new Office();
        jiaowuOffice4.setName("教务办公室——湘潭");
        OrganizationComponent xingzhengOffice4 = new Office();
        xingzhengOffice4.setName("行政办公室——湘潭");
        beijing.addComponent(jiaowuOffice1);
        beijing.addComponent(hunanfenxiao);
        beijing.addComponent(xingzhengOffice);
        hunanfenxiao.addComponent(jiaowuOffice2);
        hunanfenxiao.addComponent(changshaJiaoxuediao);
        hunanfenxiao.addComponent(xiangtanjiaoxuedian);
        hunanfenxiao.addComponent(xingzhengOffice2);
        changshaJiaoxuediao.addComponent(jiaowuOffice3);
        changshaJiaoxuediao.addComponent(xingzhengOffice3);
        xiangtanjiaoxuedian.addComponent(jiaowuOffice4);
        xiangtanjiaoxuedian.addComponent(xingzhengOffice4);
        beijing.sendMessage("北京总部发送公文");
        System.out.println("----------------------");
        xiangtanjiaoxuedian.sendMessage("发送公文");
    }
}
